<!-- 我的爱车 页面-->
<include file='Common:head'/>
<style type="text/css">
</style>
<form id="upForm">
<div class="add_car_view box">
	<div class="">頭像：<img id="avatar" src="{$info.avatar}" style="padding-left:5%;width:250px;"/><input type="file" id="upload_avatar" name="upload_avatar" style="display:none;" onchange="showPicture(this)" /> <span class="uploadBtn" style="font-sizer:2.6rem;color:#A8A8A8;"><-點擊更換頭像</span></div>
	<div class="">樓&nbsp;宇&nbsp;名&nbsp;:&nbsp;<input type="text" name="shopname" value="{$info.name}"/></div>
	<div class="">營業開始時間&nbsp;:&nbsp;<input type="text" class="server_start_time" name="server_start_time" value="{$info.server_start_time}"  onfocus="this.blur();"/></div>
	<div class="">營業結束時間&nbsp;:&nbsp;<input type="text" class="server_end_time" name="server_end_time" value="{$info.server_end_time}" onfocus="this.blur();"/></div>
	<div class="">地&nbsp;址&nbsp;:&nbsp;<input type="text" name="address" value="{$info.address}"/></div>
	<div class="">服務電話&nbsp;:&nbsp;<input type="text" name="phone" value="{$info.phone}"/></div>
	<div class="">对客戶的忠告&nbsp;:&nbsp;<input type="text" name="tips" value="{$info.tips}"/></div>
	
	<div class="button"><input type="button" value="提交"/></div>
</div>
</form>
<script type="text/javascript">
$('#avatar').click(function(){
	$('input[type=file]').click();
});
$('.uploadBtn').click(function(){
	$('input[type=file]').click();
});
function showPicture(imgFile){
	var picURL = window.URL.createObjectURL(imgFile.files[0]);
	document.getElementById("avatar").src = picURL;
	$('#upload_avatar').val(picURL);
} 
</script>
<script type="text/javascript">
$('input[type=button]').click(function(){
	var formData = new FormData($( "#upForm" )[0]);   
    $.ajax({    
         url: "{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/set_shop_info')}" ,  /*这是处理文件上传的servlet*/  
         type: 'POST',    
         data : formData,    
         async: false,    
         cache: false,    
         contentType: false,    
         processData: false,    
         success: function (returndata) {    
        	 if(returndata.status==1){
        		 layer.open({
      				style:'font-size:3rem;',
      				content:returndata.info,
      				time:2,
      				end:function(){
     					window.location.href = returndata.url;
     		 		}
      			});
        	 }else{
        		 layer.open({
       				style:'font-size:3rem;',
       				content:returndata.info,
       				time:2,
       			});
        	 }
         }
    }); 
});


$( function() {
	var calendar = new datePicker();
	calendar.init({
	    'trigger': '.server_start_time', /*按钮选择器，用于触发弹出插件*/
	    'type': 'time',/*模式：date日期；datetime日期时间；time时间；ym年月；*/
	    'onSubmit':function(){
	        var theSelectData=calendar.value;
	        $('.server_start_time').val(theSelectData);
	    },
	    onClose:function(){
	    }
	});
	
	var calendar1 = new datePicker();
	calendar1.init({
	    'trigger': '.server_end_time', /*按钮选择器，用于触发弹出插件*/
	    'type': 'time',/*模式：date日期；datetime日期时间；time时间；ym年月；*/
	    'onSubmit':function(){
	        var theSelectData1=calendar1.value;
	        $('.server_end_time').val(theSelectData1);
	    },
	    onClose:function(){
	    }
	});
});


//申明表單內容變量
var savePostData = {} ;

$(document).ready(function(){
	$('title').html('設置店鋪基本訊息');
	$('.header .title').html('設置店鋪基本訊息');
	$('.header .left').html('<img src="__PRIVATE__/images/left.png" style="width:55%"/>');
	$('.header .right').html('');
	$('.header .left').click(function(){
		//返回-我的爱车
		window.location.href = "{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/set_index')}";
	});
});


</script>
<include file='Common:footer'/>
